<?php

namespace App\Http\Controllers;

use App\Models\DownloadJob;
use App\Services\DownloadJobService;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;

class DownloadJobController extends Controller
{
    public $downloadJobService;

    public function __construct(DownloadJobService $downloadJobService)
    {
        parent::__construct();
        $this->downloadJobService = $downloadJobService;
    }

    /**
     * 获取数据列表
     *
     * @param Request $request
     * @return JsonResponse
     * @author: lxk
     * @date: 2025-03-04 11:04
     */
    public function index(Request $request) : JsonResponse
    {
        $perPage = $request->input('per_page') ?: $this->limit;

        $list = $this->downloadJobService->getList($request, $perPage);

        return $this->success($list);
    }

}
